home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
program
/
funnel.zoo
/
sources
/
data.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-11
|
27KB
|
513 lines
/*##############################################################################
FUNNNELWEB COPYRIGHT
====================
FunnelWeb is a literate-programming macro preprocessor.
Copyright (C) 1992 Ross N. Williams.
Ross N. Williams
ross@spam.adelaide.edu.au
16 Lerwick Avenue, Hazelwood Park 5066, Australia.
This program is free software; you can redistribute it and/or modify
it under the terms of Version 2 of the GNU General Public License as
published by the Free Software Foundation.
This program is distributed WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See Version 2 of the GNU General Public License for more details.
You should have received a copy of Version 2 of the GNU General Public
License along with this program. If not, you can FTP the license from
prep.ai.mit.edu/pub/gnu/COPYING-2 or write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Section 2a of the license requires that all changes to this file be
recorded prominently in this file. Please record all changes here.
Programmers:
RNW Ross N. Williams ross@spam.adelaide.edu.au
Changes:
07-May-1992 RNW Program prepared for release under GNU GPL V2.
##############################################################################*/
/******************************************************************************/
/* DATA.H */
/******************************************************************************/
/* */
/* This package (data.h, data.c) contains ALL of the global variables in */
/* FunnelWeb. Some of the FunnelWeb packages (e.g. the lister) harbour hidden */
/* static state variables which could be considered to be a global variable, */
/* but, these aside, this package contains all the variables that are used */
/* directly by more than one package. In many programs, it would likely be */
/* appropriate to have a separate package for each distinct group of shared */
/* data so that only those packages needing a particular group of data need */
/* see it. However, in FunnelWeb's case, the variables are so few, and their */
/* use so widespread that they are clustered here in one package for all to */
/* see. */
/* */
/* This package also contains type definitions for the central FunnelWeb data */
/* structures. */
/* */
/******************************************************************************/
/* Ensure that the body of this header file is included at most once. */
#ifndef DONE_DATA
#define DONE_DATA
/******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include "style.h"
#include "clock.h"
#include "list.h"
#include "table.h"
#include "option.h"
#include "section.h"
#include "writfile.h"
/******************************************************************************/
/* */
/* DATA TYPES */
/* ========== */
/* The following section contains all the data types of the global variables. */
/* */
/******************************************************************************/
/* The following structure defines a position in the global listing of the */
/* input data by storing a line number and a column number. The line number */
/* is a global line number meaning that it increases continuously through */
/* the lines of included files. The first line is line number 1. The first */
/* (leftmost) column is column number 1. */
typedef
struct
{
ulong ps_line;
ulong ps_column;
} ps_t ;
typedef ps_t *p_ps_t; /* A pointer to a position is handy too! */
/******************************************************************************/
/* A macro name is represented simply as a character array. */
#define NAME_MAX 80
typedef char name_t[NAME_MAX+1];
typedef name_t *p_name_t;
/******************************************************************************/
/* SC stands for SCrap of text. A scrap of text is a contiguous group of */
/* printable bytes in memory. The following structure defines such a group by */
/* storing a pointer to the first and last character of the scrap. */
/* The scrap must contain at least one character (i.e. sc_last>=sc_first). */
typedef
struct
{
char *sc_first; /* Pointer to the first byte of the scrap. */
char *sc_last; /* Pointer to the last byte of the scrap. */
bool sc_white; /* TRUE iff the scrap consists entirely of whitespace. */
} sc_t;
typedef sc_t *p_sc_t;
/******************************************************************************/
/* LN stands for LiNe. This record holds global and local line numbers as */
/* well as a scrap that points to the line in question. The scanner (which */
/* generates this list) guarantees that the last character of the line scrap */
/* is an EOL. */
typedef
struct
{
sc_t ln_body; /* Scrap pointing to the line. Line ends in EOL. */
ulong ln_global; /* Global line number of this line. */
ulong ln_local; /* Local line number of this line. */
} ln_t;
/* The global line list is simply a list of lines of the following type. */
typedef p_ls_t p_lnls_t;
/******************************************************************************/
/* The following enumerated type identifies a font. */
#define FT_NORM 1
#define FT_TITL 2
#define FT_STIT 3
/* The following enumerated type identifies a horizontal alignment. */
#define LR_LEFT 1
#define LR_RIGH 2
#define LR_CENT 3
/* We want to pack a font and an alignment into the tk_gen byte of the token */
/* record (we could create a new field, but as none of the other token kinds */
/* require an extra field, we choose to pack instead. The formula is this: */
/* Packed byte=LRFT_PACK*FONT+ALIGNMENT. */
#define LRFT_PACK 10
/******************************************************************************/
/* The following enumerated type identifies the kind of a token. */
#define TK_TEXT 1 /* Text segment. */
#define TK_NSEC 2 /* @A..New section. */
#define TK_MDEF 3 /* @$ Macro definition. */
#define TK_FDEF 4 /* @F File definition. */
#define TK_ONAM 5 /* @< Open name. */
#define TK_CNAM 6 /* @> Close name. */
#define TK_ODEF 7 /* @{ Open definition. */
#define TK_CDEF 8 /* @} Close definition. */
#define TK_OPAR 9 /* @( Open parameter list. */
#define TK_CPAR 10 /* @) Close parameter list. */
#define TK_COMA 11 /* @, Comma. */
#define TK_QUOT 12 /* @" Quote. */
#define TK_PARM 13 /* @1 Parameter. */
#define TK_ZERO 14 /* @Z Zero calls allowed. */
#define TK_MANY 15 /* @M Many calls allowed. */
#define TK_NAME 16 /* @# Self contained name. */
#define TK_EMPH 17 /* @/ Emphasize text. */
#define TK_NPAG 18 /* @t..Newpage. */
#define TK_TOCS 19 /* @t..Table of contents. */
#define TK_SKIP 20 /*